<?php include("../includes/header-member.php") ?>
<title>LazySwim</title>
</head>

<body>
<div id="page">
    <div id="page-top">
        <div id="page-bottom">
          <div id="header">
                <div id="header-info">
                    <h1>LAZYSWIM</h1>
                    <div class="description">Simplistic Swim System</div>
                </div>
				<!-- Header Goes Here -->
                <?php printHeader(); ?>
				<!-- Header Ends Here -->
                <div id="header-date">Today is <?php echo date('l, F jS, Y'); ?></div>
                <div id="header-cats">
				<!-- Welcome Message Starts Here -->
                    <ul>
					<?php include("../../includes/welcomeBar.php"); ?>
					</ul>
				<!-- Welcome Message Ends Here -->	
                </div>
            </div>
            <div id="main">

                <div id="sidebar">
                    <div class="sidebar-box">
                    <h3>Mail</h3>
                    <ul>
                        <li class="page_item"><a href="newMessage.php">New Message</a></li>
                        <li class="page_item"><a href="inbox.php">Inbox</a></li>
                        <li class="page_item"><a href="outbox.php">Outbox</a></li>
                    </ul>
                    </div>
                    <?php
					// include the corresponding navigation page
                    include("../../includes/navigation.php");
					?>    
                </div>

            <!-- main body -->
			
			<div class="featured-post"> 
			
				<div class="post-title"><h2>New Message</h2></div>
				<div class="post-entry">
			
				<?php 
				require_once("../includes/dbInfo.php");
				$user = $_SESSION['ls_userid'];

				?>

				<form name="sendform" method="post" action="send.php">
				<table width="450" > 
					<tr> 
						<td height="38" colspan="2" valign="top">
							<?php  
								echo "<input name=\"senderID\" type=\"hidden\" value=\"$user\">"; 
							
								echo "<table><tr><th rowspan=2>Send To:</th><th>Users</th>";
								if( $_SESSION['ls_accounttype'] == "manager") {
									echo "<th>Groups</th>";
								}
								echo "</tr><tr><td><select name=\"receiverID[]\" size=4 multiple>";
								// get possible users
								$user_sql = mysql_query("SELECT * from accounts") or die(mysql_error()); 
								while( $row = mysql_fetch_array($user_sql)) {
									echo "<option value=\"" . $row[userID] . "\">" . $row[name] . "</option>";
								}
								echo "</select></td>";
								
								if( $_SESSION['ls_accounttype'] == "manager" ) {
									echo "<td><select name=\"groupID[]\" size=4 multiple>";
									$groups_sql = mysql_query("SELECT * from groups") or die(mysql_error());
									while( $row = mysql_fetch_array($groups_sql)) {
										echo "<option value=\"" . $row[userID] . "\">" . $row[name] . "</option>";
									}
								}
								echo "</select></td></tr></table>";
								
							?>
						</td> 
					</tr> 
					<tr> 
						<td height="27" colspan="2" valign="top"> 
						  <b>Subject:</b><input name="subject" type="text" id="subject" size="40" maxlength="50">     
						</td> 
					<tr> 
						<td height="184" colspan="2" valign="top">
						  <b>Message:</b>
						  <textarea name="message" id="message" cols="70" rows="10"></textarea> 
						</td> 
					<tr> 
						<td width="100%">
						  <input type="submit" name="button" id="button" value="Submit"> 
					</tr> 
				</table>
				</form> 
				
				
				</div>
			</div>
				
            <div class="clear"></div>

            </div>
			<!-- Footer Goes Here -->
            <?php include("../../includes/footer.php"); ?>
			<!-- Footer Ends Here -->
        </div>
    </div>
</div>
</body>
</html>